import http from './http'

import qs from 'qs'
const purchaseConfig = {
    transformRequest: [
        function (data) {
            return qs.stringify(data);
        }
    ],
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
    }
};

const purchaseUpdateConfig = {
    headers: {
        'Content-Type': 'application/json',
    }
};
export const getAllPurchase = params => http('get', '/api/getAllPurchases', params)

export const deletePurchase = params => http('delete', '/api/deletePurchase', params)
export const addPurchase = params => http('post', '/api/saveNewPurchase', params, purchaseConfig)

export const updateOnePurchase = params => http('post', '/api/updateOnePurchase', params, purchaseUpdateConfig)